﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Survey.DataAccessLayer.Data;
using Survey.Entity;

namespace Survey.DataAccessLayer
{
    public class QuestionAccessor : Accessor<Question>
    {
        private QuestionOptionAccessor _optionAccessor;
        private QuestionFeedbackAccessor _feedbackAccessor;
        public QuestionAccessor() : base(new SurveyDbContext()) {
            _optionAccessor = new QuestionOptionAccessor();
            _feedbackAccessor = new QuestionFeedbackAccessor();
        }
        public Question GetQuestion(int id)
        {
            var q = Select(question => question.Id == id);
            return q.Single();
        }
        /// <summary>
        /// 返回选择题的每个选项的选择次数
        /// </summary>
        /// <param name="question"></param>
        /// <returns></returns>
        public IEnumerable<int> GetFeedback(Question question)
        {
            List<int> returnVal = new List<int>();

            return returnVal;
        }
    }
}
